package com.feng.common.web;

import java.io.Serializable;
import java.util.Objects;

/**
 * web项目通用返回
 */
public class WebCommonResponse<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    public final static String CODE_OK = "0000";
    public final static String CODE_UN_KNOW_FAIL = "9999";
    public final static String DESC_SUCCESS = "Success";
    public final static String DESC_UN_KNOW_FAIL = "Failed, Unknown Reason";

    /**
     * 返回码
     */
    private String statusCode;

    /**
     * 返回结果描述
     */
    private String statusDesc;

    /**
     * 返回数据
     */
    private T responseData;

    /**
     * 附加数据
     */
    private Objects additionalData;

    public String getStatusCode() {
        return statusCode;
    }

    public WebCommonResponse<T> setStatusCode(String statusCode) {
        this.statusCode = statusCode;
        return this;
    }

    public String getStatusDesc() {
        return statusDesc;
    }

    public WebCommonResponse<T> setStatusDesc(String statusDesc) {
        this.statusDesc = statusDesc;
        return this;
    }

    public T getResponseData() {
        return responseData;
    }

    public WebCommonResponse<T> setResponseData(T responseData) {
        this.responseData = responseData;
        return this;
    }

    public Objects getAdditionalData() {
        return additionalData;
    }

    public WebCommonResponse<T> setAdditionalData(Objects additionalData) {
        this.additionalData = additionalData;
        return this;
    }

    @Override
    public String toString() {
        return "WebCommonResponse{" +
                "statusCode='" + statusCode + '\'' +
                ", statusDesc='" + statusDesc + '\'' +
                ", responseData=" + responseData +
                ", additionalData=" + additionalData +
                '}';
    }
}
